<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Login
 *
 * @author markos
 */
class VirtualLabs_Rest_Login {
//put your code here

    /**
     * Check an asynchronous job status by the $jobid
     * 
     * @param string $id Job id to verify
     * @return mixed $jobStatus An array with the information about the job.
     */
    public function login($username, $password) {
        $url = array();
        $url["response"] = "json";
        $url["command"] = "login";
        $url["username"] = $username;
        $url["password"] = $password;
        $v = new VirtualLabs_Rest_HttpClient_Client();

        $response = $v->call($url);

        $loginResponse = Zend_Json_Decoder::decode($response);
        foreach ($v->get_cookie() as $value) {
            $tmp = explode("=", $value);
            $loginResponse['loginresponse'][$tmp[0]] = $tmp[1];
        }

        return $loginResponse;
    }

}

?>
